import yaml  
  
# 读取YAML文件  
with open('config.yml', 'r', encoding="gbk", errors="replace") as file:  
    data = yaml.safe_load(file)  
  
# 将数据写入新的YAML文件  
with open('config.yaml', 'w') as file:  
    yaml.dump(data, file, encoding='gbk', allow_unicode=True)